get object by name blender python

41

bpy.data.objects['OBJECT'].select = True
ob = bpy.context.scene.objects["Cube"]       # Get the object
bpy.ops.object.select_all(action='DESELECT') # Deselect all objects
bpy.context.view_layer.objects.active = ob   # Make the cube the active object 
ob.select_set(True)                          # Select the cube

Comments

Submit
0 Comments